home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / CHSONE.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-29  |  537b  |  20 lines

  1. PROCEDURE chsone(bins,ebins: barray; nbins,knstrn: integer;
  2.        VAR df,chsq,prob: real);
  3. (* Programs using routine CHSONE must define the types
  4. TYPE
  5.    barray = ARRAY [1..nbins] OF real;
  6. in the main routine.   *)
  7. VAR
  8.    j: integer;
  9. BEGIN
  10.    df := nbins-1-knstrn;
  11.    chsq := 0.0;
  12.    FOR j := 1 TO nbins DO BEGIN
  13.       IF (ebins[j] <= 0.0) THEN BEGIN
  14.          writeln('pause in CHSONE - bad expected number')
  15.       END;
  16.       chsq := chsq+sqr(bins[j]-ebins[j])/ebins[j]
  17.    END;
  18.    prob := gammq(0.5*df,0.5*chsq)
  19. END;
  20.